/**
 * Copyright 2025 Adobe. All rights reserved.
 * This file is licensed to you under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License. You may obtain a copy
 * of the License at http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under
 * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS
 * OF ANY KIND, either express or implied. See the License for the specific language
 * governing permissions and limitations under the License.
 */

@import url("./spectrum-search.css");
@import url("./search-overrides.css");

:host {
    --mod-textfield-spacing-inline: var(--spectrum-alias-infieldbutton-full-height-m);
}

input::-webkit-search-cancel-button {
    display: none;
}

:host([size="s"]) #textfield {
    --spectrum-search-border-radius: var(--system-search-size-s-border-radius);
    --spectrum-search-edge-to-visual: var(--system-search-size-s-edge-to-visual);
}

:host([size="l"]) #textfield {
    --spectrum-search-border-radius: var(--system-search-size-l-border-radius);
    --spectrum-search-edge-to-visual: var(--system-search-size-l-edge-to-visual);
}

:host([size="xl"]) #textfield {
    --spectrum-search-border-radius: var(--system-search-size-xl-border-radius);
    --spectrum-search-edge-to-visual: var(--system-search-size-xl-edge-to-visual);
}

/**
 * While overriding the need for `size="m"` in SWC, these values correct the
 * cascade when attempting to delivery the Clear Button within the Search UI.
 **/
@media (forced-colors: active) {
    sp-clear-button {
        --spectrum-clearbutton-fill-background-color: transparent;
        --spectrum-clearbutton-fill-background-color-disabled: transparent;
        --spectrum-clearbutton-fill-background-color-down: transparent;
        --spectrum-clearbutton-fill-background-color-hover: transparent;
        --spectrum-clearbutton-fill-background-color-key-focus: transparent;
    }
}
